<template>
    <el-image style="width: 100%; height: 100%" :src="getCover(src)" fit="cover" lazy>
        <template #error>
            <div class="image-slot">
                <el-icon><icon-picture /></el-icon>
            </div>
        </template>
    </el-image>
</template>

<script type="text/javascript">
import { Picture as IconPicture } from '@element-plus/icons-vue'

export default {
    components: {
        IconPicture
    },
    props: {
        src: {
            type: [String, Array, Object]
        }
    },
    methods: {
        getCover(cover = "") {
            let url = '/images/shark/le-default-goods-bg.png';
            if (cover) {
                return cover;
            }
            return url;
        },
    },
};
</script>
<style type="text/css">
:deep(.el-image) {
    line-height: 100%;
    text-align: center;
}

.image-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #f5f7fa;
    color: #BBBFC8;
}

.image-icon {
    font-size: 50px;
    line-height: 50px;
    height: 50px;
    width: 50px;
}
</style>